<?
include '../config.inc.php';
$username = @$_GET['username'];
$password = @$_GET['password'];
include '../member.php';
if($admin != '1'){
  exit;
}
?>
<!DOCTYPE html>
<html>    
<meta http-equiv="content-type" content="text/html;charset=utf-8">
 <head>
 <script src="../js/jquery.1.7.2.min.js"></script>
 <link href="../layui/css/layui.css" rel="stylesheet" type="text/css"/>
 <script src="../layer/layer.js"></script>
 <script src="../layui/layui.js"> </script>
<body>
 <textarea id="ball_money" placeholder="请输入红包金额" type="textarea" autosize="[object Object]" rows="2" autocomplete="off"validateevent="true" class="el-textarea__inner" style="height:25px;"></textarea><br>
 <textarea id="ball_number" placeholder="请输入红包个数" type="textarea" autosize="[object Object]" rows="2" autocomplete="off"validateevent="true" class="el-textarea__inner" style="height:25px;"></textarea><br>
  <textarea id="ball_type"  type="textarea" autosize="[object Object]" rows="2" autocomplete="off" validateevent="true" class="el-textarea__inner" style="height:25px;">0</textarea><span>0代表平分红包</span><br>
  <button id="send_ball_btn" class="layui-btn layui-btn-small">发送红包</button>
  </body>
  <script>
  function send_balls(){
  var username = '<? echo $username;?>'
  var password = '<? echo $password;?>'

  var ball_money = document.getElementById('ball_money').value;
  var ball_number = document.getElementById('ball_number').value;
  var ball_type = document.getElementById('ball_type').value;
  if(ball_money == ''){
     layer.msg('请输入红包金额');
	 return false;
  }
  if(ball_number == ''){
     layer.msg('请输入红包个数');
	 return false;
  }
  if(ball_number == 0){
     layer.msg('红包个数不能为0');
	 return false;
  }
  if(ball_type == ''){
     layer.msg('请输入红包类型');
	 return false;
  }
  $.post("send_ball_post.php", { ball_money: ball_money,ball_number: ball_number,ball_type: ball_type,username: username,password: password},
   function(data){
	//返回值
   layer.msg(data);
   });
document.getElementById('ball_money').value = '';
document.getElementById('ball_number').value = '';
document.getElementById('ball_type').value = '';
}

   //点击按钮发送
 var oBtn = document.getElementById('send_ball_btn');
    oBtn.onclick = function(){
        send_balls();
};

  </script>